package org.deva.erp.base.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.PostPersist;
import javax.persistence.PostRemove;
import javax.persistence.PostUpdate;
import javax.persistence.PrePersist;
import javax.persistence.PreRemove;
import javax.persistence.PreUpdate;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Project: erp<br>
 * Description: 实体基类，封装了实体的公共信息<br>
 * Copyright (c) 2012<br>
 * All Rights Reserved.<br>
 * @author <a href="mailto:gly420@163.com">GuanLuYong</a><br>
 */
@MappedSuperclass
public class BaseEntity extends IdEntity implements Serializable {

	private static final long serialVersionUID = 1L;
    
	@Column(name = "ADD_BY", length = 50, nullable = true)
	private String addBy;
	
	@Column(name = "ADD_DATE", nullable = true)
	@Temporal(TemporalType.TIMESTAMP)
	private Date addDate;
	
	@Column(name = "MOD_BY", length = 50, nullable = true)
	private String modBy;
	
	@Column(name = "MOD_DATE", nullable = true)
	@Temporal(TemporalType.TIMESTAMP)
	private Date modDate;
	
	@Column(name = "STATUS")
	private Long status;
	
	@Column(name = "REMARKS", nullable = true, length = 255)
	private String remarks;

	public BaseEntity() {
		super();
	}
	
	// before persist entity
	@PrePersist public void prePersist() { }
	// after persist entity
	@PostPersist public void postPersist() { }
	
	// before update entity
	@PreUpdate public void preUpdate() { }
	// after update entity
	@PostUpdate public void postUpdate() { }
	// before remove entity
	@PreRemove public void preRemove() { }
	// after remove entity
	@PostRemove public void postRemove() { }

	// Getter && Setter
	public String getAddBy() {
		return addBy;
	}
	
	public void setAddBy(String addBy) {
		this.addBy = addBy;
	}
	
	public Date getAddDate() {
		return addDate;
	}
	
	public void setAddDate(Date addDate) {
		this.addDate = addDate;
	}
	
	public String getModBy() {
		return modBy;
	}
	
	public void setModBy(String modBy) {
		this.modBy = modBy;
	}
	
	public Date getModDate() {
		return modDate;
	}
	
	public void setModDate(Date modDate) {
		this.modDate = modDate;
	}
	
	public Long getStatus() {
		return status;
	}
	
	public void setStatus(Long status) {
		this.status = status;
	}
	
	public String getRemarks() {
		return remarks;
	}
	
	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	
}
